(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[     23024,        572]
NotebookOptionsPosition[     21651,        528]
NotebookOutlinePosition[     21997,        543]
CellTagsIndexPosition[     21954,        540]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[TextData[StyleBox["MotorGearScrewLink",
 FontFamily->"System"]], "Section",
 Evaluatable->False,
 CellChangeTimes->{
  3.522604736109375*^9, 3.52260476665625*^9, {3.5375221220952315`*^9, 
   3.5375221278764815`*^9}, {3.537869482578125*^9, 3.53786948590625*^9}, {
   3.5934148241421313`*^9, 3.593414828241541*^9}}],

Cell["\<\
Electric motor with gear to a screw and a link with intertia.\
\>", "Text",
 CellChangeTimes->{{3.522604737421875*^9, 3.522604750875*^9}, {
  3.6058567276387095`*^9, 3.6058567532702723`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"domain", "=", "\"\<Electric\>\""}], ";"}], "\n", 
 RowBox[{
  RowBox[{"displayName", "=", "\"\<MotorGearScrewLink\>\""}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
  "brief", "=", 
   "\"\<Electric motor with gearbox, screw, link and inertia load\>\""}], 
  ";"}], "\n", 
 RowBox[{
  RowBox[{"componentType", "=", "\"\<ComponentQ\>\""}], ";"}], "\n", 
 RowBox[{
  RowBox[{"author", "=", "\"\<Petter Krus <petter.krus@liu.se>\>\""}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
  "affiliation", " ", "=", " ", 
   "\"\<Division of Fluid and Mechatronic Systems, Link\[ODoubleDot]ping \
University\>\""}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"SetFilenames", "[", 
   RowBox[{"defaultPath", ",", "domain", ",", "displayName"}], "]"}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"ResetComponentVariables", "[", "]"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"Date", "[", "]"}]}], "Input",
 CellChangeTimes->{{3.503905077842648*^9, 3.503905079842648*^9}, {
   3.5039103076641607`*^9, 3.5039103985397425`*^9}, {3.5039164662834997`*^9, 
   3.5039164750178747`*^9}, {3.5039165143772497`*^9, 
   3.5039165189397497`*^9}, {3.5041051675625*^9, 3.504105226359375*^9}, {
   3.507570546125*^9, 3.507570569546875*^9}, {3.507570601046875*^9, 
   3.50757067696875*^9}, 3.507796401609375*^9, {3.507887022343302*^9, 
   3.507887057967846*^9}, {3.5078871702320337`*^9, 3.507887175028847*^9}, {
   3.5082235454098396`*^9, 3.5082235597692146`*^9}, 3.5082237305660896`*^9, {
   3.512921352515625*^9, 3.512921388578125*^9}, {3.513708407234375*^9, 
   3.51370842740625*^9}, 3.513708469203125*^9, {3.5137087323125*^9, 
   3.513708733765625*^9}, {3.513708789984375*^9, 3.5137088199375*^9}, {
   3.513709315953125*^9, 3.5137093166875*^9}, {3.51370934803125*^9, 
   3.513709386875*^9}, 3.515393228397682*^9, 3.515394538846967*^9, {
   3.521777776703125*^9, 3.521777777328125*^9}, {3.5375221420014815`*^9, 
   3.5375221550639815`*^9}, {3.537869450671875*^9, 3.53786947475*^9}, 
   3.550745776859375*^9, 3.5757729419860697`*^9, 3.575773125384227*^9, {
   3.59341479652137*^9, 3.5934147991286306`*^9}, {3.593414838520569*^9, 
   3.593414849573674*^9}, {3.605856761738119*^9, 3.605856763978343*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"nodeConnections", "=", 
   RowBox[{"{", "\[IndentingNewLine]", "\t", 
    RowBox[{
     RowBox[{"ElectricQnode", "[", 
      RowBox[{"el1", ",", "0.", ",", "\"\<port 1\>\""}], "]"}], ",", 
     "\[IndentingNewLine]", "\t", 
     RowBox[{"ElectricQnode", "[", 
      RowBox[{"el2", ",", "0.", ",", "\"\<port 2\>\""}], "]"}], ",", 
     "\[IndentingNewLine]", "\t", 
     RowBox[{"MechanicRotQnode", "[", 
      RowBox[{
      "mr1", ",", "0.", ",", "0.", ",", "\"\<Mechanical rot.connection\>\""}],
       "]"}]}], "\[IndentingNewLine]", "}"}]}], ";"}]], "Input",
 CellChangeTimes->{
  3.51371110959375*^9, {3.515486897105438*^9, 3.5154868972460594`*^9}, {
   3.5154963499562235`*^9, 3.5154963505968523`*^9}, {3.515525281796875*^9, 
   3.515525324359375*^9}, {3.515560997171875*^9, 3.51556103534375*^9}, {
   3.515685350796875*^9, 3.51568536184375*^9}, {3.515685595984375*^9, 
   3.515685598703125*^9}, {3.51572598011862*^9, 3.5157259948825703`*^9}, 
   3.51862799871875*^9, {3.521778232359375*^9, 3.521778233796875*^9}, 
   3.550859248484375*^9, {3.593414877881505*^9, 3.5934148800657234`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"inputParameters", "=", 
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
      "Ke", ",", "0.13", ",", "double", ",", "\"\<V/rpm\>\"", ",", 
       "\"\<emf constant\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "Ra", ",", "0.04", ",", "double", ",", "\"\<Ohm\>\"", ",", 
       "\"\<motor resistance\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "Tm0", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
       "\"\<zero speed friction of motor\>\""}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "wc", ",", "1.", ",", "double", ",", "\"\<rad/s\>\"", ",", 
       "\"\<Friction speed (for numerics)\>\""}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "Bm", ",", "0.0012", ",", "double", ",", "\"\<Nms/rad\>\"", ",", 
       "\"\<Visc. fric. coeff., motor\>\""}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "Jm", ",", "1", ",", "double", ",", "\"\<kg m^2\>\"", ",", 
       "\"\<Moment of inertia, motor\>\""}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "myg", ",", ".01", ",", "double", ",", "\"\<\>\"", ",", 
       "\"\<friction. coeff. of gear (at output)\>\""}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "mys", ",", "0.001", ",", "double", ",", "\"\<\>\"", ",", 
       "\"\<friction. coeff. of screw)\>\""}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "BL", ",", "0.0", ",", "double", ",", "\"\<Ns/m\>\"", ",", 
       "\"\<Visc. fric. coeff., load\>\""}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "JL", ",", "1", ",", "double", ",", "\"\<kg m^2\>\"", ",", 
       "\"\<Moment of inertia, load\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "pitch", ",", "0.0008", ",", "double", ",", "\"\<m/rad\>\"", ",", 
       "\"\<gear ratio sf2/sfim\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{"thetamin", ",", 
       RowBox[{"-", "0.5"}], ",", "double", ",", "\"\<rad\>\"", ",", 
       "\"\<min angle\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "thetamax", ",", "0.5", ",", "double", ",", "\"\<rad\>\"", ",", 
       "\"\<max angle\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "la", ",", "0.08", ",", "double", ",", "\"\<m\>\"", ",", 
       "\"\<link length\>\""}], "}"}]}], "\[IndentingNewLine]", "}"}]}], 
  ";"}]], "Input",
 CellChangeTimes->{{3.51370929940625*^9, 3.51370929940625*^9}, {
   3.513709582640625*^9, 3.513709583484375*^9}, {3.513939656771557*^9, 
   3.513939661740243*^9}, {3.515524764375*^9, 3.515524840125*^9}, {
   3.515727322344883*^9, 3.5157273865459538`*^9}, 3.518260862875*^9, 
   3.518261225265625*^9, 3.519040872671875*^9, 3.519040945984375*^9, 
   3.51906377815625*^9, {3.51911507559375*^9, 3.519115108265625*^9}, {
   3.519115167890625*^9, 3.51911521371875*^9}, {3.51911576046875*^9, 
   3.519115764109375*^9}, {3.519118910390625*^9, 3.519118922671875*^9}, {
   3.5191190169375*^9, 3.5191191019375*^9}, {3.519192115375*^9, 
   3.5191921193125*^9}, {3.5375238393139815`*^9, 3.5375238484855795`*^9}, {
   3.537524323352693*^9, 3.5375243361023664`*^9}, {3.55074595865625*^9, 
   3.55074596603125*^9}, {3.5934147590676246`*^9, 3.593414760651783*^9}, {
   3.6054549730964985`*^9, 3.6054549784698057`*^9}, {3.605455048858832*^9, 
   3.605455100500786*^9}, 3.66485658507437*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"inputVariables", "=", 
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
     "gearRatio", ",", "1.", ",", "double", ",", "\"\<\>\"", ",", 
      "\"\<gearing w1/w2\>\""}], "}"}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.51879550009375*^9, 3.51879554940625*^9}, 
   3.519063771984375*^9, 3.519064900515625*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"outputVariables", "=", 
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
      "wm", ",", "0.", ",", "double", ",", "\"\<rad/s\>\"", ",", 
       "\"\<motor speed\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "tormg", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
       "\"\<Generated motor torque\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "Pin", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
       "\"\<Input power\>\""}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
      "Pout", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
       "\"\<Output power\>\""}], "}"}]}], "\[IndentingNewLine]", "}"}]}], 
  ";"}]], "Input",
 CellChangeTimes->{{3.518547082234375*^9, 3.5185471520625*^9}, 
   3.518547487640625*^9, {3.518628009390625*^9, 3.518628013953125*^9}, {
   3.51904117421875*^9, 3.5190412405625*^9}, {3.519105757*^9, 
   3.51910577603125*^9}, {3.51910591740625*^9, 3.519105935296875*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"wme", "=", 
   RowBox[{"gearRatio", " ", "wmr1"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"Tm0e", "=", " ", 
   RowBox[{"Tm0", " ", 
    RowBox[{"limit", "[", " ", 
     RowBox[{
      RowBox[{"wmr1", "/", " ", "wc"}], ",", 
      RowBox[{"-", "1."}], ",", "1."}], "]"}]}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"tormge", "=", 
   RowBox[{
    RowBox[{"Ke", " ", "iel2"}], "-", 
    RowBox[{"Bm", " ", "wme"}], "-", "Tm0e"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"tore", "=", 
   RowBox[{"gearRatio", " ", "tormge"}]}], ";"}]}], "Input",
 CellChangeTimes->{{3.515560667421875*^9, 3.5155606675*^9}, {
   3.515560725140625*^9, 3.515560785453125*^9}, {3.5155609716875*^9, 
   3.515560972265625*^9}, 3.518260873453125*^9, 3.51904099365625*^9, {
   3.519041154953125*^9, 3.51904115653125*^9}, {3.51910365884375*^9, 
   3.519103674109375*^9}, 3.5191037251875*^9, {3.51911567465625*^9, 
   3.519115708015625*^9}, 3.5371673845764513`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"Tfrg", "=", 
   RowBox[{
    RowBox[{"(", 
     RowBox[{"myg", " ", 
      RowBox[{"Abs", "[", "tormr1", "]"}]}], ")"}], " ", 
    RowBox[{"limit", "[", " ", 
     RowBox[{
      RowBox[{"wmr1", "/", " ", "wc"}], ",", 
      RowBox[{"-", "1."}], ",", "1."}], "]"}]}]}], ";"}]], "Input",
 CellChangeTimes->{
  3.51911504184375*^9, {3.51911515415625*^9, 3.51911516159375*^9}, {
   3.51911523025*^9, 3.519115245296875*^9}, 3.519115521796875*^9, {
   3.51911561315625*^9, 3.519115638296875*^9}, 3.519115712546875*^9, 
   3.51911581653125*^9, {3.5371673679045763`*^9, 3.5371673845920763`*^9}, {
   3.5375238091108565`*^9, 3.5375238286108565`*^9}, {3.5375238869518676`*^9, 
   3.5375238961231556`*^9}, {3.5508979645*^9, 3.55089796478125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"Tfrs", "=", 
   RowBox[{
    RowBox[{"(", 
     RowBox[{"mys", " ", 
      RowBox[{"Abs", "[", "tormr1", "]"}]}], ")"}], " ", 
    RowBox[{"limit", "[", " ", 
     RowBox[{
      RowBox[{"wmr1", "/", " ", "wc"}], ",", 
      RowBox[{"-", "1."}], ",", "1."}], "]"}]}]}], ";"}]], "Input",
 CellChangeTimes->{{3.5375238054858565`*^9, 3.5375238340014815`*^9}, {
   3.5375239025758677`*^9, 3.537523905544428*^9}, 3.55089796890625*^9}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"gear1", "=", 
   SuperscriptBox[
    RowBox[{"(", 
     FractionBox[
      RowBox[{"gearRatio", " ", "la"}], "pitch"], ")"}], "2"]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"gear2", "=", 
   SuperscriptBox[
    RowBox[{"(", 
     FractionBox["la", "pitch"], ")"}], "2"]}], ";"}]}], "Input",
 CellChangeTimes->{{3.5375236877983565`*^9, 3.5375237150952315`*^9}, {
  3.550898310453125*^9, 3.550898331359375*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"systemEquationsDa", ":=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"gearRatio", " ", "Jm"}], "+", "JL"}], ")"}], " ", 
       RowBox[{"Der", "[", "wmr1", " ", "]"}]}], "+", " ", 
      RowBox[{"gear1", " ", "Tfrg"}], "+", 
      RowBox[{"gear2", " ", "Tfrs"}], "+", 
      RowBox[{"BL", " ", "wmr1"}], "-", 
      RowBox[{"(", 
       RowBox[{"tore", "-", "tormr1"}], ")"}]}], ",", "\[IndentingNewLine]", 
     "\t", 
     RowBox[{
      RowBox[{"Der", "[", "thetamr1", "]"}], "-", "wmr1"}], ",", 
     "\[IndentingNewLine]", "\t", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{"uel1", "-", "uel2"}], ")"}], "-", 
      RowBox[{"(", 
       RowBox[{
        RowBox[{"Ra", " ", "iel2"}], " ", "+", " ", 
        RowBox[{"Ke", " ", "wme"}]}], ")"}]}]}], "\[IndentingNewLine]", "\t", 
    "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.5137095851875*^9, 3.513709592578125*^9}, {
   3.513711114796875*^9, 3.51371111625*^9}, {3.5155248569375*^9, 
   3.515524880078125*^9}, {3.515524973140625*^9, 3.515524989140625*^9}, {
   3.51552505634375*^9, 3.515525088140625*^9}, {3.515560561484375*^9, 
   3.51556057584375*^9}, 3.515560757375*^9, 3.515560881015625*^9, {
   3.515561183375*^9, 3.515561184140625*^9}, {3.51556127203125*^9, 
   3.5155612795*^9}, {3.5157263492789683`*^9, 3.5157263555012937`*^9}, {
   3.5157297162142982`*^9, 3.5157297444174232`*^9}, {3.518260864515625*^9, 
   3.5182608670625*^9}, {3.518260976875*^9, 3.518261012625*^9}, {
   3.518261087015625*^9, 3.51826110178125*^9}, {3.5182612159375*^9, 
   3.51826127765625*^9}, {3.51826132946875*^9, 3.518261351578125*^9}, {
   3.519040873453125*^9, 3.51904087634375*^9}, {3.51904094640625*^9, 
   3.519040947421875*^9}, 3.5190409941875*^9, 3.51904114153125*^9, {
   3.519041298375*^9, 3.519041305921875*^9}, 3.519103681765625*^9, {
   3.51910372815625*^9, 3.5191037285625*^9}, {3.51911514003125*^9, 
   3.519115140890625*^9}, 3.51911524771875*^9, 3.5371673845920763`*^9, {
   3.5375237693139815`*^9, 3.5375237747046065`*^9}, {3.550898360546875*^9, 
   3.550898390546875*^9}, 3.6031911495019655`*^9}],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"wme", "=", 
   RowBox[{"gearRatio", " ", "wmgear"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"vscrew", "=", " ", 
   RowBox[{"wmr1", " ", "la"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"wmgear", "=", 
   FractionBox["vscrew", "pitch"]}], ";"}]}], "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.},
 CellChangeTimes->{{3.5375226898608565`*^9, 3.5375227970796065`*^9}, 
   3.5375231527827315`*^9, {3.5375232320952315`*^9, 3.5375232444389815`*^9}, 
   3.5375236034546065`*^9, {3.605856660472994*^9, 3.605856674875434*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"Der", "=."}], ";", 
  RowBox[{"s", "=."}], ";"}]], "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.},
 CellChangeTimes->{{3.5375229213921065`*^9, 3.5375229272827315`*^9}, 
   3.605856674875434*^9}]
}, Closed]],

Cell[BoxData[
 RowBox[{
  RowBox[{"systemEquationsDa", ":=", 
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"gearRatio", " ", "Jm"}], "+", "JL"}], ")"}], " ", 
       RowBox[{"Der", "[", 
        RowBox[{"Der", "[", "thetamr1", " ", "]"}], "]"}]}], "+", " ", 
      RowBox[{"gear1", " ", "Tfrg"}], "+", 
      RowBox[{"gear2", " ", "Tfrs"}], "+", 
      RowBox[{"gear1", " ", "wmr1"}], "-", 
      RowBox[{"(", 
       RowBox[{"tore", "-", "tormr1"}], ")"}]}], ",", 
     RowBox[{
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"gearRatio", " ", "Jm"}], "+", "JL"}], ")"}], " ", 
       RowBox[{"Der", "[", "wmr1", " ", "]"}]}], "+", " ", 
      RowBox[{"gear1", " ", "Tfrg"}], "+", 
      RowBox[{"gear2", " ", "Tfrs"}], "+", 
      RowBox[{"gear1", " ", "wmr1"}], "-", 
      RowBox[{"(", 
       RowBox[{"tore", "-", "tormr1"}], ")"}]}], ",", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{"uel1", "-", "uel2"}], ")"}], "-", 
      RowBox[{"(", 
       RowBox[{
        RowBox[{"Ra", " ", "iel2"}], " ", "+", " ", 
        RowBox[{"Ke", " ", "wme"}]}], ")"}]}]}], "\[IndentingNewLine]", "\t", 
    "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.5137095851875*^9, 3.513709592578125*^9}, {
   3.513711114796875*^9, 3.51371111625*^9}, {3.5155248569375*^9, 
   3.515524880078125*^9}, {3.515524973140625*^9, 3.515524989140625*^9}, {
   3.51552505634375*^9, 3.515525088140625*^9}, {3.515560561484375*^9, 
   3.51556057584375*^9}, 3.515560757375*^9, 3.515560881015625*^9, {
   3.515561183375*^9, 3.515561184140625*^9}, {3.51556127203125*^9, 
   3.5155612795*^9}, {3.5157263492789683`*^9, 3.5157263555012937`*^9}, {
   3.5157297162142982`*^9, 3.5157297444174232`*^9}, {3.518260864515625*^9, 
   3.5182608670625*^9}, {3.518260976875*^9, 3.518261012625*^9}, {
   3.518261087015625*^9, 3.51826110178125*^9}, {3.5182612159375*^9, 
   3.51826127765625*^9}, {3.51826132946875*^9, 3.518261351578125*^9}, {
   3.519040873453125*^9, 3.51904087634375*^9}, {3.51904094640625*^9, 
   3.519040947421875*^9}, 3.5190409941875*^9, 3.51904114153125*^9, {
   3.519041298375*^9, 3.519041305921875*^9}, 3.519103681765625*^9, {
   3.51910372815625*^9, 3.5191037285625*^9}, {3.51911514003125*^9, 
   3.519115140890625*^9}, 3.51911524771875*^9, 3.5371673845920763`*^9, 
   3.53786952125*^9, {3.537869565484375*^9, 3.537869582546875*^9}, {
   3.550744693984375*^9, 3.550744701953125*^9}, {3.5508982625*^9, 
   3.550898269*^9}, {3.550898441890625*^9, 3.550898499640625*^9}, {
   3.5508985379375*^9, 3.550898566484375*^9}, {3.6054553769966*^9, 
   3.605455378228671*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"variable2Limits", "=", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{"thetamr1", ",", "wmr1", ",", "thetamin", ",", "thetamax"}], 
     "}"}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.6054552506693745`*^9, 3.605455273104658*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"boundaryEquations", "=", 
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"uel1", "-", "cel1", "+", 
      RowBox[{"Zcel1", " ", "iel2"}]}], ",", "\[IndentingNewLine]", 
     RowBox[{"uel2", "-", "cel2", "-", 
      RowBox[{"Zcel2", " ", "iel2"}]}], ",", "\[IndentingNewLine]", 
     RowBox[{"tormr1", " ", "-", " ", "cmr1", " ", "-", " ", 
      RowBox[{"Zcmr1", " ", "wmr1"}]}]}], "\[IndentingNewLine]", "}"}]}], 
  ";"}]], "Input",
 CellChangeTimes->{{3.513709484578125*^9, 3.513709484578125*^9}, {
  3.515490149741*^9, 3.515490151006625*^9}, {3.51556122921875*^9, 
  3.51556123359375*^9}, {3.515561274515625*^9, 3.515561294265625*^9}, {
  3.5157263110717087`*^9, 3.515726324467642*^9}, {3.5157298428080482`*^9, 
  3.5157298429017982`*^9}, {3.5158131639265437`*^9, 3.515813165879506*^9}, {
  3.5160312933125*^9, 3.516031294484375*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"systemVariables", " ", "=", " ", 
   RowBox[{"{", 
    RowBox[{
    "thetamr1", ",", "wmr1", ",", "iel2", ",", "uel1", ",", "uel2", ",", 
     "tormr1"}], "}"}]}], ";"}]], "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.},
 CellChangeTimes->{{3.51370899921875*^9, 3.5137090601875*^9}, {
   3.513709135484375*^9, 3.513709184734375*^9}, 3.515486918636137*^9, {
   3.515493296482911*^9, 3.515493296842286*^9}, {3.515493662074348*^9, 
   3.5154936675586176`*^9}, 3.515493810883874*^9, {3.515561127234375*^9, 
   3.515561128046875*^9}, {3.5157277872105813`*^9, 3.515727788163694*^9}, {
   3.5157297108861732`*^9, 3.5157297109799232`*^9}, 3.519041445078125*^9, {
   3.51910373490625*^9, 3.51910373909375*^9}, {3.550898557984375*^9, 
   3.550898559734375*^9}, 3.6058566871246586`*^9}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"Pin", "=."}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"Pout", "=."}], ";"}]}], "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.},
 CellChangeTimes->{{3.51910586278125*^9, 3.519105869328125*^9}, 
   3.6058566871246586`*^9}]
}, Closed]],

Cell[BoxData[
 RowBox[{
  RowBox[{"expressions", " ", "=", " ", 
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"wm", ",", 
       RowBox[{"gearRatio", " ", "wmr1"}]}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{"iel1", ",", " ", 
       RowBox[{"-", "iel2"}]}], "}"}], ",", " ", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{"tormg", ",", " ", "tormge"}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{"Pin", ",", 
       RowBox[{
        RowBox[{"(", 
         RowBox[{"uel1", "-", "uel2"}], ")"}], " ", "iel2"}]}], "}"}], ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{"Pout", ",", 
       RowBox[{"wmr1", " ", "tormr1"}]}], "}"}]}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.515525016296875*^9, 3.515525028234375*^9}, {
   3.5155612083125*^9, 3.51556121028125*^9}, 3.5157297806361732`*^9, {
   3.5190410831875*^9, 3.519041083203125*^9}, {3.519041163625*^9, 
   3.51904116503125*^9}, {3.519041372109375*^9, 3.51904139265625*^9}, {
   3.5191036971875*^9, 3.519103708921875*^9}, {3.519105819578125*^9, 
   3.519105904671875*^9}}],

Cell[BoxData[
 RowBox[{"Compgen", "[", "file", "]"}]], "Input"]
}, Open  ]]
},
WindowSize->{707, 817},
WindowMargins->{{Automatic, 210}, {-27, Automatic}},
FrontEndVersion->"10.3 for Microsoft Windows (64-bit) (October 9, 2015)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 318, 6, 63, "Section",
 Evaluatable->False],
Cell[900, 30, 201, 4, 30, "Text"],
Cell[1104, 36, 2252, 45, 212, "Input"],
Cell[3359, 83, 1129, 22, 112, "Input"],
Cell[4491, 107, 3673, 82, 332, "Input"],
Cell[8167, 191, 374, 9, 52, "Input"],
Cell[8544, 202, 1088, 25, 132, "Input"],
Cell[9635, 229, 1014, 25, 92, "Input"],
Cell[10652, 256, 771, 17, 31, "Input"],
Cell[11426, 275, 464, 12, 31, "Input"],
Cell[11893, 289, 460, 14, 89, "Input"],
Cell[12356, 305, 2168, 45, 132, "Input"],
Cell[CellGroupData[{
Cell[14549, 354, 593, 13, 87, "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.}],
Cell[15145, 369, 243, 6, 31, "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.}]
}, Closed]],
Cell[15403, 378, 2681, 56, 146, "Input"],
Cell[18087, 436, 274, 7, 31, "Input"],
Cell[18364, 445, 891, 17, 112, "Input"],
Cell[CellGroupData[{
Cell[19280, 466, 823, 15, 31, "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.}],
Cell[20106, 483, 280, 7, 52, "Input",
 CellGroupingRules->{GroupTogetherGrouping, 10000.}]
}, Closed]],
Cell[20401, 493, 1168, 29, 126, "Input"],
Cell[21572, 524, 63, 1, 31, "Input"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
